module.exports = {
    main: async (event) => {
          let { data = {}, userInfo, util, originalParam } = event;
          let { uniID, pubFun, vk , db, _ } = util;
          let res = { code : 0, msg : 'ok' };
          let dbName = "system-dic"
          // 业务逻辑开始----------------------------------------------------------- 
          if (!data.name) {
              return {
                  code: 412,
                  msg: '名称不能为空'
              }
          }
          if (!data.type) {
              return {
                  code: 412,
                  msg: '类型不能为空'
              }
          }
          let info = await db.collection(dbName).where({name: data.name}).get();
          if (info.data.length > 0) {
              return {
                  code: 412,
                  msg: '已存在该名称'
              }
          }
          res.data = await vk.baseDao.add({
              dbName,
              dataJson: data
          },event.util);
          return res;
    }
  
  }